<?
	require_once "../../_func/__Global.php";
	require_once "../../_func/__Local.php";
	require_once "../../_func/__MysqlFunc.php";
	require_once "../../_func/_MngFunc.php";
	require_once "../../_func/_Validation.php";
	
	$type = 'C';
	$level = '1';
	$code = null;
	$flag = "destination";
	$code_type_name = "출하처코드명";
	
	if ( ValidCheck_isSelfRequest($_SERVER['HTTP_REFERER']) ) {
		if ( $mode == 'u' ) {

			//get parameter
			$code_seq 			= $param->getString('code_seq');
			$code_name 			= $param->getString('code_name');
			$code_code1			= $param->getString('code_code1');
			$code_code2			= $param->getString('code_code2');
			$code_type			= $type;
			$code_display		= $param->getString('code_display');
			
			//공백허용하지 않는것을 먼저 등록하여 유효성 검사
			$insert_arr = array(
				'code_name'			=> $code_name,
				'code_type'			=> $code_type,
				'code_code1'		=> $code_code1,
				'code_code2'		=> $code_code2,
				'code_display'		=> $code_display,
			);
			
			$isValid = true;
			foreach( $insert_arr as $key => $val )
			{
				if (!ValidCheck_isNotEmpty($val)) {
					errMsg($VALIDATE_ERROR_MESSAGE);
					$isValid = false;
				}
			}

			if ( $isValid )
			{
				//코드등록후 코드일련번호 취득
				$result	= CodeUpdate( $insert_arr, $code_seq );

				if( $result )
				{
					cacheControl(0);
					ob_clean();
					jserrorPop("수정되었습니다.", true, true);
				}
				else {
					errMsg("수정실패입니다..");
				}
			}
		}
		else {
			errMsg("비정상적인 접근입니다.");
		}
	} else {
?>

<? include("code_mod.inc"); ?>

<?
	}
?>